<?php
namespace Home\Controller;
use Think\Controller;
header("Content-Type: text/html; charset=UTF-8");
class GoodsController extends Controller
{
    public function index()
    {
        $goodsModel = D('goods');
        $goods = $goodsModel->select();//返回二维数组
        //var_dump($goods);die();
        $this->assign(array(
                'goods' => $goods,
        ));
        $this->display();
    }

    public function single()
    {
        $goodsModel = D('goods');
        $gid = I('get.gid');
        $goods = $goodsModel->where("gid = $gid")->find();
//        var_dump($goods);die();
        $this->assign(array(
            'goods' => $goods,
        ));
        $this->display();
    }

    //购物车
    public function checkout(){
        $this->display();
    }
}